package com.nts.visionworks.business.endpoint.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * ErrorRecord generated by hbm2java
 */
@Entity
@Table(name = "error_record", catalog = "visionworks")
public class ErrorRecord implements java.io.Serializable
{

	private ErrorRecordId id;
	private EndPoint endPoint;
	private String errorCode;
	private String message;
	private String exception;
	private String stackTrace;

	public ErrorRecord()
	{
	}

	public ErrorRecord(ErrorRecordId id, EndPoint endPoint, String errorCode,
			String message)
	{
		this.id = id;
		this.endPoint = endPoint;
		this.errorCode = errorCode;
		this.message = message;
	}

	public ErrorRecord(ErrorRecordId id, EndPoint endPoint, String errorCode,
			String message, String exception, String stackTrace)
	{
		this.id = id;
		this.endPoint = endPoint;
		this.errorCode = errorCode;
		this.message = message;
		this.exception = exception;
		this.stackTrace = stackTrace;
	}

	@EmbeddedId
	@AttributeOverrides(
	{
			@AttributeOverride(name = "happendDateTime", column = @Column(name = "HappendDateTime", nullable = false, length = 19)),
			@AttributeOverride(name = "endPointId", column = @Column(name = "EndPointId", nullable = false)) })
	public ErrorRecordId getId()
	{
		return this.id;
	}

	public void setId(ErrorRecordId id)
	{
		this.id = id;
	}

	@EntityIdNotNull(message = "validation.errorRecord.endPoint.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "EndPointId", nullable = false, insertable = false, updatable = false)
	public EndPoint getEndPoint()
	{
		return this.endPoint;
	}

	public void setEndPoint(EndPoint endPoint)
	{
		this.endPoint = endPoint;
	}

	@NotNull(message = "validation.errorRecord.errorCode.notNull")
	@Size(message = "validation.errorRecord.errorCode.length", max = 20, min = 1)
	@Column(name = "ErrorCode", nullable = false, length = 20)
	public String getErrorCode()
	{
		return this.errorCode;
	}

	public void setErrorCode(String errorCode)
	{
		this.errorCode = errorCode;
	}

	@NotNull(message = "validation.errorRecord.message.notNull")
	@Size(message = "validation.errorRecord.message.length", max = 500, min = 1)
	@Column(name = "Message", nullable = false, length = 500)
	public String getMessage()
	{
		return this.message;
	}

	public void setMessage(String message)
	{
		this.message = message;
	}

	@Max(message = "validation.errorRecord.exception.max", value = 1000)
	@Column(name = "Exception", length = 1000)
	public String getException()
	{
		return this.exception;
	}

	public void setException(String exception)
	{
		this.exception = exception;
	}

	@Max(message = "validation.errorRecord.stackTrace.max", value = 65535)
	@Column(name = "StackTrace", length = 65535)
	public String getStackTrace()
	{
		return this.stackTrace;
	}

	public void setStackTrace(String stackTrace)
	{
		this.stackTrace = stackTrace;
	}

}
